package com.webserver.core;

import com.webserver.http.HttpServerletRequest;

import java.io.IOException;
import java.net.Socket;

/*
线程任务
负责与特定的客服端进行Http交互
 */
public class ClientHandler implements Runnable{
    //提升作用域
    private Socket socket;
    //构造方法
    public ClientHandler(Socket socket){
        this.socket = socket;
    }

    @Override
    public void run() {
        //1解析请求
        try {
            HttpServerletRequest request = new HttpServerletRequest(socket);
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                socket.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        //2处理请求
        //3响应发送
    }
}
